/**
 * 作者: hxl
 * 日期: 2024-12-17 16:34:03
 * 备注: 用户七天乐活动表
 */
package com.motu.monstercity.server.game.userdata;

import com.motu.vertx.module.utility.toolset.TimeUtils;
import com.motu.vertx.module.utility.toolset.Tool;

public class UserIapGiftPush extends UserIapGiftPushModel {
    public UserIapGiftPush() {
        super();
    }

    public UserIapGiftPush(long userId, int iapGiftId) {
        putUserId(userId);
        putIapGiftId(iapGiftId);
        putResetTimeDay(TimeUtils.getCurTime());
    }

    public void reset() {
        boolean isUpdate = false;
        if (endTime != 0 && endTime < TimeUtils.getCurTime()) {
            putEndTime(0);
            putPushTriggerNum(0);
            putPushBuyNum(0);
//            putSelectIndex("");
//            putSelectNum("");
            isUpdate = true;
        }
        if (resetTimeDay == 0) {
            putResetTimeDay(TimeUtils.getCurTime());
            isUpdate = true;
        } else if (!TimeUtils.isToday(resetTimeDay)) {
            putResetTimeDay(TimeUtils.getCurTime());
            putTriggerNumDay(0);
            isUpdate = true;
        }
        if (isUpdate) {
            update();
        }
    }

}
